﻿<%@ Page Language="C#"  MasterPageFile="~/templates/template.Master" AutoEventWireup="true" CodeBehind="contacto.aspx.cs" Inherits="GesWork.maestros.contacto" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxcontroltoolkit" %>


<asp:content ID="df" runat="server" ContentPlaceHolderID="ContentPlaceHolder1">
  <ajaxcontroltoolkit:TabContainer ID="tabcont" runat="server"   Width="690px"
    ActiveTabIndex="0" >
         <ajaxcontroltoolkit:TabPanel runat="server" ID="tabUser"  HeaderText="Datos"><ContentTemplate>
             
        
        <asp:FormView ID="FormView1" runat="server" CellPadding="4" DataKeyNames="ID" DataSourceID="SqlDataSource1" 
            ForeColor="#333333"  BackColor="#b3b3b3"
            Width="670px" AllowPaging="True"  >
            <FooterStyle BackColor="#b3b3b3" Font-Bold="True" ForeColor="White" />
            <EditRowStyle  BackColor="#b3b3b3"  ForeColor="White" />
            <RowStyle BackColor="#b3b3b3"  />
            <EditItemTemplate>
                      <div class="recuadro">
                        Saludo:
                       
                             <asp:DropDownList ID="lstSaludation"    runat="server"
                             DataSourceID="dsSaludo" DataTextField="saludo" DataValueField="id" Text='<%# Bind("saludation") %>' >  
                                 
                        </asp:DropDownList>
                        <asp:SqlDataSource ConnectionString="<%$ ConnectionStrings:gesworkConnectionString %>"  

                            ID="dsSaludo" runat="server" 
                            SelectCommand="SELECT id, saludo  FROM Saludation">
                        </asp:SqlDataSource>

                           
                        <br />
                        Nombre:
                        <asp:TextBox ID="NameTextBox" runat="server" Text='<%# Bind("Name") %>' />
                        <br />
                        Primer Apellido:
                        <asp:TextBox ID="FirstNameTextBox" runat="server" 
                            Text='<%# Bind("FirstName") %>' />
                        <br />
                        Segundo Apellido:
                        <asp:TextBox ID="LastNameTextBox" runat="server" 
                            Text='<%# Bind("LastName") %>' />
                       
                       
                     <br /><br />
                         <div class="separador"></div>   
                        <br />
                        Empresa:
                        
                        <asp:DropDownList ID="cmbIdEnterprise" runat="server" DataSourceID="dsEmpresas"  Text='<%# Bind("IdEnterprise") %>'
                            DataTextField="Name" DataValueField="ID">
                        </asp:DropDownList>
                        <asp:SqlDataSource ID="dsEmpresas" runat="server" 
                            ConnectionString="<%$ ConnectionStrings:gesworkConnectionString %>" 
                            SelectCommand="SELECT [ID], [Name] FROM [Enterprise]"></asp:SqlDataSource>
                        <br />
                        Puesto:
                        <asp:TextBox ID="PostTextBox" runat="server" Text='<%# Bind("Post") %>' />
                       
                       
                     <br /><br />
                         <div class="separador"></div>   
                        <br />
                        
                        Fecha de Nacimiento:
                        <ajaxcontroltoolkit:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="BirthDayTextBox"  FirstDayOfWeek="Monday" Format="dd/MM/yyyy" > </ajaxcontroltoolkit:CalendarExtender>
                        <asp:TextBox ID="BirthDayTextBox" runat="server" 
                            Text='<%# Bind("BirthDay") %>' />
                        <br />
                        
                        Telefono 1:
                        <asp:TextBox ID="CI_Telephone1TextBox" runat="server" 
                            Text='<%# Bind("CI_Telephone1") %>' />
                        <br />
                        Telefono 2:
                        <asp:TextBox ID="CI_Telephone2TextBox" runat="server" 
                            Text='<%# Bind("CI_Telephone2") %>' />
                        <br />
                       Telefono 3:
                        <asp:TextBox ID="CI_Telephone3TextBox" runat="server" 
                            Text='<%# Bind("CI_Telephone3") %>' />
                        <br />
                        Fax:
                        <asp:TextBox ID="CI_FaxTextBox" runat="server" Text='<%# Bind("CI_Fax") %>' />
                        <br />
                        Email 1:
                        <asp:TextBox ID="CI_Email1TextBox" runat="server" 
                            Text='<%# Bind("CI_Email1") %>' />
                        <br />
                        Email 2:
                        <asp:TextBox ID="CI_Email2TextBox" runat="server" 
                            Text='<%# Bind("CI_Email2") %>' />
                        <br />
                        Email 3:
                        <asp:TextBox ID="CI_Email3TextBox" runat="server" 
                            Text='<%# Bind("CI_Email3") %>' />
                        <br />
                        Web:
                        <asp:TextBox ID="CI_WebTextBox" runat="server" Text='<%# Bind("CI_Web") %>' />
                        
                        
                     <br /><br />
                         <div class="separador"></div>   
                        <br />
                        
                      Relacion:
                         <asp:DropDownList ID="DropDownList1" 
                            Text='<%# Bind("CC_IdRelationShip") %>' runat="server" 
                            DataSourceID="dsRelaciones" DataTextField="Description" DataValueField="ID"  >  
                        
                              
                        </asp:DropDownList>
                        <asp:SqlDataSource ID="dsRelaciones" runat="server" 
                            ConnectionString="<%$ ConnectionStrings:gesworkConnectionString %>" 
                            SelectCommand="SELECT [ID], [Description] FROM [Relations]">
                        </asp:SqlDataSource>
                        <br />
                        
                       
                        Categoria:
                        <asp:DropDownList ID="DropDownList2" runat="server" 
                        
                             Text='<%# Bind("CC_IdCategory") %>' DataSourceID="dsCategoria" 
                            DataTextField="Description" DataValueField="ID" />
                        <asp:SqlDataSource ID="dsCategoria" runat="server" 
                            ConnectionString="<%$ ConnectionStrings:gesworkConnectionString %>" 
                            SelectCommand="SELECT [ID], [Description] FROM [ContactCategory]">
                        </asp:SqlDataSource>
                        <br />
                        
                         <br /><br />
                         <div class="separador"></div>   
                        <br />
                        
                        Responsable:
                        <asp:TextBox ID="IdOwnerUserTextBox" runat="server" 
                            Text='<%# Bind("IdOwnerUser") %>' />
                       
                     <br /><br />
                         <div class="separador"></div>   
                        <br />
                        
                        
                        
<asp:ImageButton ID="UpdateButton" runat="server"  ImageUrl="~/images/btnGuardar.png"  CssClass="botones" CausesValidation="True" 
                            CommandName="Update"  />
                       
<asp:ImageButton ID="UpdateCancelButton" runat="server"  ImageUrl="~/images/btnCancelar.png"  CssClass="botones" 
                            CausesValidation="False" CommandName="Cancel" />
                  </div>
            </EditItemTemplate>
            <InsertItemTemplate>
                   <div class="recuadro">
                    <b>Saludo:</b>
                    
                         <asp:DropDownList ID="lstSaludation" Text='<%# Bind("Saludation") %>' 
                        runat="server" DataSourceID="dsSaludo" DataTextField="saludo" 
                        DataValueField="id"  >  
                    
                          
                    </asp:DropDownList>
                    <asp:SqlDataSource ID="dsSaludo" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:gesworkConnectionString %>" 
                        SelectCommand="SELECT [id], [saludo] FROM [Saludation]"></asp:SqlDataSource>
                    <br />
                    <b>Nombre:</b>
                    <asp:TextBox ID="NameTextBox" runat="server" Text='<%# Bind("Name") %>' />
                    <br />
                    <b>Primer Apellido :</b>
                    <asp:TextBox ID="FirstNameTextBox" runat="server" 
                        Text='<%# Bind("FirstName") %>' />
                    <br />
                    <b>Segundo Apellido:</b>
                    <asp:TextBox ID="LastNameTextBox" runat="server" 
                        Text='<%# Bind("LastName") %>' />
                    
                    
                     <br /><br />
                         <div class="separador"></div>   
                        <br />
                     <b>Empresa:</b>
                    
                    <asp:DropDownList ID="cmbIdEnterprise" runat="server" DataSourceID="dsEmpresas"  Text='<%# Bind("IdEnterprise") %>'
                        DataTextField="Name" DataValueField="ID">
                    </asp:DropDownList>
                    <asp:SqlDataSource ID="dsEmpresas" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:gesworkConnectionString %>" 
                        SelectCommand="SELECT [ID], [Name] FROM [Enterprise]"></asp:SqlDataSource>
                    <br />    
                    <b>Puesto:</b>
                    <asp:TextBox ID="PostTextBox" runat="server" Text='<%# Bind("Post") %>' />
                    
                     <br /><br />
                         <div class="separador"></div>   
                        <br />
                    
                    <b>Fecha de Nacimiento:</b>
                    <ajaxcontroltoolkit:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="BirthDayTextBox"  FirstDayOfWeek="Monday" Format="dd/MM/yyyy" > </ajaxcontroltoolkit:CalendarExtender>
                    <asp:TextBox ID="BirthDayTextBox" runat="server" 
                        Text='<%# Bind("BirthDay") %>' />
                    <br />
                   
                    <b>Telefono 1:</b>
                    <asp:TextBox ID="CI_Telephone1TextBox" runat="server" 
                        Text='<%# Bind("CI_Telephone1") %>' />
                    <br />
                    <b>Telefono 2:</b>
                    <asp:TextBox ID="CI_Telephone2TextBox" runat="server" 
                        Text='<%# Bind("CI_Telephone2") %>' />
                    <br />
                    <b>Telefono 3:</b>
                    <asp:TextBox ID="CI_Telephone3TextBox" runat="server" 
                        Text='<%# Bind("CI_Telephone3") %>' />
                    <br />
                    <b>Fax:
                    <asp:TextBox ID="CI_FaxTextBox" runat="server" Text='<%# Bind("CI_Fax") %>' />
                    <br />
                    <b>Email1:</b>
                    <asp:TextBox ID="CI_Email1TextBox" runat="server" 
                        Text='<%# Bind("CI_Email1") %>' />
                    <br />
                    <b>Email 2:</b>
                    <asp:TextBox ID="CI_Email2TextBox" runat="server" 
                        Text='<%# Bind("CI_Email2") %>' />
                    <br />
                    <b>Email 3:</b>
                    <asp:TextBox ID="CI_Email3TextBox" runat="server" 
                        Text='<%# Bind("CI_Email3") %>' />
                    <br />
                    <b>Web:</b>
                    <asp:TextBox ID="CI_WebTextBox" runat="server" Text='<%# Bind("CI_Web") %>' />
                    
                    
                     <br /><br />
                         <div class="separador"></div>   
                        <br />
                        
                    <b>Relacion:</b>
                   
                     <asp:DropDownList ID="CC_IdRelationShipTextBox" 
                        Text='<%# Bind("CC_IdRelationShip") %>' runat="server" 
                        DataSourceID="dsRelaciones" DataTextField="Description" DataValueField="ID"  >  
                    
                          
                    </asp:DropDownList>
                    <asp:SqlDataSource ID="dsRelaciones" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:gesworkConnectionString %>" 
                        SelectCommand="SELECT [ID], [Description] FROM [Relations]">
                    </asp:SqlDataSource>
                    <br />
                    <b>Categoria:</b>
                    <asp:DropDownList ID="CC_IdCategoryTextBox" runat="server" 
                    
                         Text='<%# Bind("CC_IdCategory") %>' DataSourceID="dsCategoria" 
                        DataTextField="Description" DataValueField="ID" />
                    <asp:SqlDataSource ID="dsCategoria" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:gesworkConnectionString %>" 
                        SelectCommand="SELECT [ID], [Description] FROM [ContactCategory]">
                    </asp:SqlDataSource>
                  
                   <br /><br />
                         <div class="separador"></div>   
                        <br />
                        
                    <b>Propietario:</b>
                    <asp:TextBox ID="IdOwnerUserTextBox" runat="server" 
                        Text='<%# Bind("IdOwnerUser") %>' />
                    <br />
                    
                     <br /><br />
                         <div class="separador"></div>   
                        <br />
                          
                    
<asp:ImageButton ID="InsertButton" runat="server"  ImageUrl="~/images/btnGuardar.png"  CssClass="botones" CausesValidation="True" 
                        CommandName="Insert"  />
                   
<asp:ImageButton ID="InsertCancelButton" runat="server"  ImageUrl="~/images/btnCancelar.png"  CssClass="botones" 
                        CausesValidation="False" CommandName="Cancel" />
                  </div>      
                
            </InsertItemTemplate>
            <ItemTemplate>
            
            
            
            
             <div class="separador"></div> <br /> 
                <b>Identificador: </b>
                <asp:Label ID="IDLabel" runat="server" Text='<%# Eval("ID") %>' />
                <br />
                 <br />
                 <div class="separador"></div> 
                 
                 <br />
                <b>Nombre :</b>
                <asp:Label ID="NameLabel" runat="server" Text='<%# Bind("saludo") %>  <%# Bind("Name") %>' />
                <br />
                <b>Apellidos:</b>
                <asp:Label ID="FirstNameLabel" runat="server" Text='<%# Bind("FirstName") %>' />
                <asp:Label ID="LastNameLabel" runat="server" Text='<%# Bind("LastName") %>' />
                <br /> <br /> 
                 <div class="separador"></div> 
                 <br />
                <b>Empresa:</b>
                <a href='<%# "empresa.aspx?id=" + Eval("identerprise") %>'><asp:Label ID="IdEnterpriseLabel" runat="server" 
                    Text='<%# Bind("Company") %>' /> </a>
                <br />
                <b>Puesto:</b>
                
                    <asp:Label ID="PostLabel" runat="server" Text='<%# Bind("Post") %>' />
               
                <br /><br /> 
                 <div class="separador"></div> 
                 <br />
                 <b>Relacion:</b>
                <asp:Label ID="CC_IdRelationShipLabel" runat="server" 
                    Text='<%# Bind("relacion") %>' />
                <br />
                <b>Categoria:</b>
                <asp:Label ID="CC_IdCategoryLabel" runat="server" 
                    Text='<%# Bind("categoria") %>' />
                <br />
                <b>IdOwnerUser:</b>
                <asp:Label ID="IdOwnerUserLabel" runat="server" 
                    Text='<%# Bind("IdOwnerUser") %>' />
                <br /><br /> 
                 <div class="separador"></div> 
                 <br />
                
                <b>Telefonos:</b>
                <asp:Label ID="CI_Telephone1Label" runat="server" 
                    Text='<%# Bind("CI_Telephone1") %>    ' />
               
               
                <asp:Label ID="CI_Telephone2Label" runat="server" 
                    Text='<%# Bind("CI_Telephone2") %>     ' />
                
                
                <asp:Label ID="CI_Telephone3Label" runat="server" 
                    Text='<%# Bind("CI_Telephone3") %>' />
                <br />
                <b>FAX:</b>
                <asp:Label ID="CI_FaxLabel" runat="server" Text='<%# Bind("CI_Fax") %>' />
                <br />
                <b>Correos Electronicos:</b>
                <a href='<%# "mailto:" + Eval("CI_Email1") %> '><asp:Label ID="CI_Email1Label" runat="server" Text='<%# Bind("CI_Email1") %>   ' /></a>
               
               
                <a href='<%# "mailto:" + Eval("CI_Email2") %> '><asp:Label ID="CI_Email2Label" runat="server" Text='<%# Bind("CI_Email2") %>   ' /></a>
             
                
                <a href='<%# "mailto:" + Eval("CI_Email3") %> '><asp:Label ID="CI_Email3Label" runat="server" Text='<%# Bind("CI_Email3") %>' /></a>
                <br />
                <b>Fecha de Nacimiento:</b>
                
                <asp:Label ID="BirthDayLabel" runat="server" Text='<%# Bind("BirthDay", "{0:dd/MM/yyyy}") %>' />
                <br />
                <b>Pagina Web:</b>
                <asp:Label ID="CI_WebLabel" runat="server" Text='<%# Bind("CI_Web") %>' />
                <br /><br /> 
                 <div class="separador"></div> 
               
                
                
                <br />
                   
<asp:ImageButton ID="EditButton" runat="server"  ImageUrl="~/images/btnEditar.png"  CssClass="botones" CausesValidation="False" 
                    CommandName="Edit" Text="Editar" />

 <asp:ImageButton ID="DeleteButton" runat="server"  ImageUrl="~/images/btnEliminar.png"  CssClass="botones" CausesValidation="False" 
                    CommandName="Delete" Text="Eliminar" />

<asp:ImageButton ID="NewButton" runat="server"  ImageUrl="~/images/btnNuevo.png"  CssClass="botones" CausesValidation="False" CommandName="New" 
                    Text="Nuevo" />
                        
                 
                
            </ItemTemplate>
            <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
            <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
            <EditRowStyle BackColor="#000000" />
        </asp:FormView>
         
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:gesworkConnectionString %>" 
        SelectCommand="SELECT Contact.id, Contact.saludation, Contact.name, firstname, lastname, birthday, Contact.identerprise, Contact.CI_telephone1, Contact.CI_telephone2, Contact.CI_telephone3, Contact.CI_Fax, Contact.ci_email1, Contact.ci_email2, Contact.ci_email3, Contact.ci_web, Contact.post, Contact.CC_IdRelationShip, Contact.CC_IdCategory , Contact.IdOwnerUser, enterprise.name as company , Relations.description as relacion, ContactCategory.description as categoria ,saludo FROM [Contact], [SALUDATION], Enterprise, Relations, ContactCategory WHERE Contact.ID =  @ID  AND  Saludation.id=Saludation AND Contact.identerprise=Enterprise.id AND Contact.CC_IdRelationShip=Relations.id AND Contact.CC_IdCategory=ContactCategory.id" 
            DeleteCommand="DELETE FROM [Contact] WHERE [ID] = @ID" 
            InsertCommand="INSERT INTO [Contact] ( [Saludation], [Name], [FirstName], [LastName], [Post], [BirthDay], [IdEnterprise], [CI_Telephone1], [CI_Telephone2], [CI_Telephone3], [CI_Fax], [CI_Email1], [CI_Email2], [CI_Email3], [CI_Web], [CC_IdRelationShip], [CC_IdCategory], [IdOwnerUser]) VALUES ( @Saludation, @Name, @FirstName, @LastName, @Post, @BirthDay, @IdEnterprise, @CI_Telephone1, @CI_Telephone2, @CI_Telephone3, @CI_Fax, @CI_Email1, @CI_Email2, @CI_Email3, @CI_Web, @CC_IdRelationShip, @CC_IdCategory, @IdOwnerUser)" 
            UpdateCommand="UPDATE [Contact] SET [Saludation] = @Saludation, [Name] = @Name, [FirstName] = @FirstName, [LastName] = @LastName, [Post] = @Post, [BirthDay] = @BirthDay, [IdEnterprise] = @IdEnterprise, [CI_Telephone1] = @CI_Telephone1, [CI_Telephone2] = @CI_Telephone2, [CI_Telephone3] = @CI_Telephone3, [CI_Fax] = @CI_Fax, [CI_Email1] = @CI_Email1, [CI_Email2] = @CI_Email2, [CI_Email3] = @CI_Email3, [CI_Web] = @CI_Web, [CC_IdRelationShip] = @CC_IdRelationShip, [CC_IdCategory] = @CC_IdCategory, [IdOwnerUser] = @IdOwnerUser WHERE [ID] = @ID">
        <SelectParameters>
            <asp:QueryStringParameter Name="ID" QueryStringField="id" Type="String" />
        </SelectParameters>
        <DeleteParameters>
            <asp:Parameter Name="ID" Type="String" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="Saludation" Type="String" />
            <asp:Parameter Name="Name" Type="String" />
            <asp:Parameter Name="FirstName" Type="String" />
            <asp:Parameter Name="LastName" Type="String" />
            <asp:Parameter Name="Post" Type="String" />
            <asp:Parameter Name="BirthDay" Type="String"/>
            <asp:Parameter Name="IdEnterprise" Type="String" />
            <asp:Parameter Name="CI_Telephone1" Type="String" />
            <asp:Parameter Name="CI_Telephone2" Type="String" />
            <asp:Parameter Name="CI_Telephone3" Type="String" />
            <asp:Parameter Name="CI_Fax" Type="String" />
            <asp:Parameter Name="CI_Email1" Type="String" />
            <asp:Parameter Name="CI_Email2" Type="String" />
            <asp:Parameter Name="CI_Email3" Type="String" />
            <asp:Parameter Name="CI_Web" Type="String" />
            <asp:Parameter Name="CC_IdRelationShip" Type="Int32" />
            <asp:Parameter Name="CC_IdCategory" Type="String" />
            <asp:Parameter Name="IdOwnerUser" Type="String" />
            <asp:Parameter Name="ID" Type="String" />
        </UpdateParameters>
        <InsertParameters>
            
            <asp:Parameter Name="Saludation" Type="String" />
            <asp:Parameter Name="Name" Type="String" />
            <asp:Parameter Name="FirstName" Type="String" />
            <asp:Parameter Name="LastName" Type="String" />
            <asp:Parameter Name="Post" Type="String" />
            
            
            <asp:Parameter Name="BirthDay" Type="String"/>
            <asp:Parameter Name="IdEnterprise" Type="String" />
            <asp:Parameter Name="CI_Telephone1" Type="String" />
            <asp:Parameter Name="CI_Telephone2" Type="String" />
            <asp:Parameter Name="CI_Telephone3" Type="String" />
            <asp:Parameter Name="CI_Fax" Type="String" />
            <asp:Parameter Name="CI_Email1" Type="String" />
            <asp:Parameter Name="CI_Email2" Type="String" />
            <asp:Parameter Name="CI_Email3" Type="String" />
            <asp:Parameter Name="CI_Web" Type="String" />
            <asp:Parameter Name="CC_IdRelationShip" Type="Int32" />
            <asp:Parameter Name="CC_IdCategory" Type="String" />
            <asp:Parameter Name="IdOwnerUser" Type="String" />
        </InsertParameters>
    </asp:SqlDataSource>
    
    
              <br />
        </p>
        <p>
        </p>
        
 </ContentTemplate>
</ajaxcontroltoolkit:TabPanel>

<ajaxcontroltoolkit:TabPanel runat="server" ID="pnlAdress"  HeaderText="Direccion">
    <ContentTemplate>


 <asp:FormView ID="fvAdress" runat="server" CellPadding="4" DataKeyNames="ID" DataSourceID="dsAddress" 
            ForeColor="#333333"  
            Width="670px" AllowPaging="True"  >
            <FooterStyle BackColor="#b3b3b3" Font-Bold="True" ForeColor="White" />
            <RowStyle BackColor="#b3b3b3"  /><EditRowStyle  BackColor="#b3b3b3"  ForeColor="White" />
            <EditItemTemplate>

<!--
             ID:
                <asp:Label ID="IDLabel1" runat="server" Text='<%# Eval("ID") %>' />
              <br />
          OwnedByID:
                <asp:TextBox ID="OwnedByIDTextBox" runat="server" 
                    Text='<%# Bind("OwnedByID") %>' />
                <br />
                OwnedByType:
                <asp:TextBox ID="OwnedByTypeTextBox" runat="server" 
                    Text='<%# Bind("OwnedByType") %>' />
                <br />
         -->
                <div class="separador"></div> 
                <br />
                
               
               <b> Tipo de direccion:</b>
                <asp:DropDownList ID="IdAddressTypeTextBox" runat="server" DataSourceID="dsTypeAddress" DataTextField="Description" 
                    DataValueField="ID"  
                    Text='<%# Bind("IdAddressType") %>' />
                     <asp:SqlDataSource ID="dsTypeAddress" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:gesworkConnectionString %>" 
                    SelectCommand="SELECT [Description], [ID] FROM [AddressType]">
                </asp:SqlDataSource>
                <br />
                Direccion:
                <asp:TextBox ID="AI_StreetTextBox" runat="server" 
                    Text='<%# Bind("AI_Street") %>' />
                <br />
                Codigo Postal:
                <asp:TextBox ID="AI_PostalCodeTextBox" runat="server" 
                    Text='<%# Bind("AI_PostalCode") %>' />
                <br />
                
                Region:
                <asp:TextBox ID="AI_RegionTextBox" runat="server" 
                    Text='<%# Bind("AI_Region") %>' />
                <br />
                
                Provincia:
                <asp:TextBox ID="AI_ProvinceTextBox" runat="server" 
                    Text='<%# Bind("AI_Province") %>' />
                <br />
                Pais:
                <asp:TextBox ID="AI_CountryTextBox" runat="server" 
                    Text='<%# Bind("AI_Country") %>' />
                <br /><br />
                  <div class="separador"></div> 
                <br />
                 Notas:<br />
                <asp:TextBox ID="NameTextBox" runat="server" Text='<%# Bind("Name") %>'  TextMode="MultiLine" Height="100px" Width="600px" />
               
                <br /><br />
                  <div class="separador"></div> 
                <br />
<!--                
                SHI_AI_Street:
                <asp:TextBox ID="SHI_AI_StreetTextBox" runat="server" 
                    Text='<%# Bind("SHI_AI_Street") %>' />
                <br />
                SHI_AI_Region:
                <asp:TextBox ID="SHI_AI_RegionTextBox" runat="server" 
                    Text='<%# Bind("SHI_AI_Region") %>' />
                <br />
                SHI_AI_PostalCode:
                <asp:TextBox ID="SHI_AI_PostalCodeTextBox" runat="server" 
                    Text='<%# Bind("SHI_AI_PostalCode") %>' />
                <br />
                SHI_AI_Province:
                <asp:TextBox ID="SHI_AI_ProvinceTextBox" runat="server" 
                    Text='<%# Bind("SHI_AI_Province") %>' />
                <br />
                SHI_AI_Country:
                <asp:TextBox ID="SHI_AI_CountryTextBox" runat="server" 
                    Text='<%# Bind("SHI_AI_Country") %>' />
                <br />
                SHI_IdShippingMethod:
                <asp:TextBox ID="SHI_IdShippingMethodTextBox" runat="server" 
                    Text='<%# Bind("SHI_IdShippingMethod") %>' />
                <br />
                SHI_IdFreightTerms:
                <asp:TextBox ID="SHI_IdFreightTermsTextBox" runat="server" 
                    Text='<%# Bind("SHI_IdFreightTerms") %>' />
                <br />
              -->  
<asp:ImageButton ID="UpdateButton" runat="server"  ImageUrl="~/images/btnGuardar.png"  CssClass="botones" CausesValidation="True" 
                    CommandName="Update" Text="Actualizar" />
               
<asp:ImageButton ID="UpdateCancelButton" runat="server"  ImageUrl="~/images/btnCancelar.png"  CssClass="botones" 
                    CausesValidation="False" CommandName="Cancel" Text="Cancelar" />
                                     
            </EditItemTemplate>
            <InsertItemTemplate>
         <!--       ID:
                <asp:TextBox ID="IDTextBox" runat="server" Text='<%# Bind("ID") %>' />
                <br />
       
        
                OwnedByID:
                <asp:TextBox ID="OwnedByIDTextBox" runat="server" 
                    Text='<%# Bind("OwnedByID") %>' />
                <br />
                OwnedByType:
                <asp:TextBox ID="OwnedByTypeTextBox" runat="server" 
                    Text='<%# Bind("OwnedByType") %>' />
                <br />
                  <div class="separador"></div> 
                 <br />
                 
       -->         
                 <div class="separador"></div> 
                <br />
             
                
                
                <b>Tipo de direccion:</b>
                <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="dsTypeAddress" DataTextField="Description" 
                    DataValueField="ID"  
                    Text='<%# Bind("IdAddressType") %>' />
                     <asp:SqlDataSource ID="dsTypeAddress" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:gesworkConnectionString %>" 
                    SelectCommand="SELECT [Description], [ID] FROM [AddressType]">
                </asp:SqlDataSource>
                
                <br />
                <b>Direccion:</b>
                <asp:TextBox ID="AI_StreetTextBox" runat="server" 
                    Text='<%# Bind("AI_Street") %>' />
                <br />
                <b>Codigo Postal:</b>
                <asp:TextBox ID="AI_PostalCodeTextBox" runat="server" 
                    Text='<%# Bind("AI_PostalCode") %>' />
                <br />
                
                <b>Localidad:</b>
                <asp:TextBox ID="AI_RegionTextBox" runat="server" 
                    Text='<%# Bind("AI_Region") %>' />
                <br />
                
                <b>Provincia:</b>
                <asp:TextBox ID="AI_ProvinceTextBox" runat="server" 
                    Text='<%# Bind("AI_Province") %>' />
                <br />
                <b>Pais:</b>
                <asp:TextBox ID="AI_CountryTextBox" runat="server" 
                    Text='<%# Bind("AI_Country") %>' />
                <br />
                
  <!--               SHI_AI_Street:
                <asp:TextBox ID="SHI_AI_StreetTextBox" runat="server" 
                    Text='<%# Bind("SHI_AI_Street") %>' />
                <br />
                SHI_AI_Region:
                <asp:TextBox ID="SHI_AI_RegionTextBox" runat="server" 
                    Text='<%# Bind("SHI_AI_Region") %>' />
                <br />
                SHI_AI_PostalCode:
                <asp:TextBox ID="SHI_AI_PostalCodeTextBox" runat="server" 
                    Text='<%# Bind("SHI_AI_PostalCode") %>' />
                <br />
                SHI_AI_Province:
                <asp:TextBox ID="SHI_AI_ProvinceTextBox" runat="server" 
                    Text='<%# Bind("SHI_AI_Province") %>' />
                <br />
                SHI_AI_Country:
                <asp:TextBox ID="SHI_AI_CountryTextBox" runat="server" 
                    Text='<%# Bind("SHI_AI_Country") %>' />
                <br />
                SHI_IdShippingMethod:
                <asp:TextBox ID="SHI_IdShippingMethodTextBox" runat="server" 
                    Text='<%# Bind("SHI_IdShippingMethod") %>' />
                <br />
                SHI_IdFreightTerms:
                <asp:TextBox ID="SHI_IdFreightTermsTextBox" runat="server" 
                    Text='<%# Bind("SHI_IdFreightTerms") %>' />
          -->     <br />
       
          <div class="separador"></div> 
                 <br />
                 <b>Notas:</b><br />
                <asp:TextBox ID="NameTextBox" runat="server" Text='<%# Bind("Name") %>'  TextMode="MultiLine" Height="100px" Width="600px" />
                
                <br /><br />
                 <div class="separador"></div> 
                <br />
                
<asp:ImageButton ID="InsertButton" runat="server"  ImageUrl="~/images/btnGuardar.png"  CssClass="botones" CausesValidation="True" 
                    CommandName="Insert" Text="Insertar" />
               
<asp:ImageButton ID="InsertCancelButton" runat="server"  ImageUrl="~/images/btnCancelar.png"  CssClass="botones" 
                    CausesValidation="False" CommandName="Cancel" Text="Cancelar" />
            </InsertItemTemplate>
            <ItemTemplate>
        <!--         ID:
                <asp:Label ID="IDLabel" runat="server" Text='<%# Eval("ID") %>' />
                <br />
                OwnedByID:
                <asp:Label ID="OwnedByIDLabel" runat="server" Text='<%# Bind("OwnedByID") %>' />
                <br />
                OwnedByType:
                <asp:Label ID="OwnedByTypeLabel" runat="server" 
                    Text='<%# Bind("OwnedByType") %>' />
                <br />
        -->     
                 <div class="separador"></div> 
                 <br />
                
                
                <b>Tipo:</b>
                <asp:Label ID="IdAddressTypeLabel" runat="server" 
                    Text='<%# Bind("AddressType") %>' />
                <br />
                <b>Direccion:</b>
                <asp:Label ID="AI_StreetLabel" runat="server" Text='<%# Bind("AI_Street") %>' />
                <br />
                <b>Codigo Postal:</b>
                <asp:Label ID="AI_PostalCodeLabel" runat="server" 
                    Text='<%# Bind("AI_PostalCode") %>' />
                <br />
                
                <b>Localidad:</b>
                <asp:Label ID="AI_RegionLabel" runat="server" Text='<%# Bind("AI_Region") %>' />
                <br />
                
                <b>Provincia:</b>
                <asp:Label ID="AI_ProvinceLabel" runat="server" 
                    Text='<%# Bind("AI_Province") %>' />
                <br />
                <b>Pais:</b>
                <asp:Label ID="AI_CountryLabel" runat="server" 
                    Text='<%# Bind("AI_Country") %>' />
               
               
               <br /><br /> 
                 <div class="separador"></div> 
                 <br />
                <b>Notas:</b>
                <asp:Label ID="NameLabel" runat="server" Text='<%# Bind("Name") %>' />
                
                <br /><br /> 
                 <div class="separador"></div> 
                 <br />
                
         <!--       SHI_AI_Street:
                <asp:Label ID="SHI_AI_StreetLabel" runat="server" 
                    Text='<%# Bind("SHI_AI_Street") %>' />
                <br />
                SHI_AI_Region:
                <asp:Label ID="SHI_AI_RegionLabel" runat="server" 
                    Text='<%# Bind("SHI_AI_Region") %>' />
                <br />
                SHI_AI_PostalCode:
                <asp:Label ID="SHI_AI_PostalCodeLabel" runat="server" 
                    Text='<%# Bind("SHI_AI_PostalCode") %>' />
                <br />
                SHI_AI_Province:
                <asp:Label ID="SHI_AI_ProvinceLabel" runat="server" 
                    Text='<%# Bind("SHI_AI_Province") %>' />
                <br />
                SHI_AI_Country:
                <asp:Label ID="SHI_AI_CountryLabel" runat="server" 
                    Text='<%# Bind("SHI_AI_Country") %>' />
                <br />
                SHI_IdShippingMethod:
                <asp:Label ID="SHI_IdShippingMethodLabel" runat="server" 
                    Text='<%# Bind("SHI_IdShippingMethod") %>' />
                <br />
                SHI_IdFreightTerms:
                <asp:Label ID="SHI_IdFreightTermsLabel" runat="server" 
                    Text='<%# Bind("SHI_IdFreightTerms") %>' />
                <br />
          --> 
          
                     <asp:ImageButton ID="EditButton" runat="server"  ImageUrl="~/images/btnEditar.png"  CssClass="botones" CausesValidation="False" 
                    CommandName="Edit" Text="Editar" />
                    
                    
               
<asp:ImageButton ID="DeleteButton" runat="server"  ImageUrl="~/images/btnEliminar.png"  CssClass="botones" CausesValidation="False" 
                    CommandName="Delete" Text="Eliminar" />
                
<asp:ImageButton ID="NewButton" runat="server"  ImageUrl="~/images/btnNuevo.png"  CssClass="botones" CausesValidation="False" 
                    CommandName="New" Text="Nuevo" />
          
          
               
            
            </ItemTemplate>
        </asp:FormView>
    
    
   
        <asp:SqlDataSource ID="dsAddress" runat="server" 
            ConnectionString="<%$ ConnectionStrings:gesworkConnectionString %>" 
            DeleteCommand="DELETE FROM [Address] WHERE [ID] = @ID" 
            InsertCommand="INSERT INTO [Address] ( [OwnedByID], [OwnedByType], [Name], [IdAddressType], [AI_Street], [AI_Region], [AI_PostalCode], [AI_Province], [AI_Country], [SHI_AI_Street], [SHI_AI_Region], [SHI_AI_PostalCode], [SHI_AI_Province], [SHI_AI_Country], [SHI_IdShippingMethod], [SHI_IdFreightTerms]) VALUES ( @OwnedByID, '2', @Name, @IdAddressType, @AI_Street, @AI_Region, @AI_PostalCode, @AI_Province, @AI_Country, @SHI_AI_Street, @SHI_AI_Region, @SHI_AI_PostalCode, @SHI_AI_Province, @SHI_AI_Country, @SHI_IdShippingMethod, @SHI_IdFreightTerms)" 
            SelectCommand="SELECT Address.ID, [OwnedByID], [OwnedByType], [Name], [IdAddressType],AddressType.description As AddressType, [AI_Street], [AI_Region], 
                            [AI_PostalCode], [AI_Province], [AI_Country], [SHI_AI_Street], [SHI_AI_Region], [SHI_AI_PostalCode], 
                            [SHI_AI_Province], [SHI_AI_Country], [SHI_IdShippingMethod], [SHI_IdFreightTerms] 

                            FROM [Address], AddressType

                            WHERE ((Address.idAddressType = AddressType.id) AND(Address.OwnedByType = 2) AND (Address.OwnedByID =  @OwnedByID))" 
            UpdateCommand="UPDATE [Address] SET [Name] = @Name, [IdAddressType] = @IdAddressType, [AI_Street] = @AI_Street, [AI_Region] = @AI_Region, [AI_PostalCode] = @AI_PostalCode, [AI_Province] = @AI_Province, [AI_Country] = @AI_Country, [SHI_AI_Street] = @SHI_AI_Street, [SHI_AI_Region] = @SHI_AI_Region, [SHI_AI_PostalCode] = @SHI_AI_PostalCode, [SHI_AI_Province] = @SHI_AI_Province, [SHI_AI_Country] = @SHI_AI_Country, [SHI_IdShippingMethod] = @SHI_IdShippingMethod, [SHI_IdFreightTerms] = @SHI_IdFreightTerms WHERE [ID] = @ID">
            <SelectParameters>
                <asp:Parameter DefaultValue="1" Name="OwnedByType" Type="Int32" />
                <asp:QueryStringParameter Name="OwnedByID" QueryStringField="id" 
                    Type="String" />
            </SelectParameters>
            <DeleteParameters>
                <asp:Parameter Name="ID" Type="Int32" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="OwnedByID" Type="String" />
                <asp:Parameter Name="OwnedByType" Type="Int32" />
                <asp:Parameter Name="Name" Type="String" />
                <asp:Parameter Name="IdAddressType" Type="Int32" />
                <asp:Parameter Name="AI_Street" Type="String" />
                <asp:Parameter Name="AI_Region" Type="String" />
                <asp:Parameter Name="AI_PostalCode" Type="String" />
                <asp:Parameter Name="AI_Province" Type="String" />
                <asp:Parameter Name="AI_Country" Type="String" />
                <asp:Parameter Name="SHI_AI_Street" Type="String" />
                <asp:Parameter Name="SHI_AI_Region" Type="String" />
                <asp:Parameter Name="SHI_AI_PostalCode" Type="String" />
                <asp:Parameter Name="SHI_AI_Province" Type="String" />
                <asp:Parameter Name="SHI_AI_Country" Type="String" />
                <asp:Parameter Name="SHI_IdShippingMethod" Type="String" />
                <asp:Parameter Name="SHI_IdFreightTerms" Type="String" />
                <asp:Parameter Name="ID" Type="Int32" />
            </UpdateParameters>
            <InsertParameters>
                <asp:Parameter Name="ID" Type="Int32" />
                <asp:QueryStringParameter Name="OwnedByID"  QueryStringField="id"  Type="String" />
                <asp:Parameter Name="OwnedByType" Type="Int32" />
                <asp:Parameter Name="Name" Type="String" />
                <asp:Parameter Name="IdAddressType" Type="Int32" />
                <asp:Parameter Name="AI_Street" Type="String" />
                <asp:Parameter Name="AI_Region" Type="String" />
                <asp:Parameter Name="AI_PostalCode" Type="String" />
                <asp:Parameter Name="AI_Province" Type="String" />
                <asp:Parameter Name="AI_Country" Type="String" />
                <asp:Parameter Name="SHI_AI_Street" Type="String" />
                <asp:Parameter Name="SHI_AI_Region" Type="String" />
                <asp:Parameter Name="SHI_AI_PostalCode" Type="String" />
                <asp:Parameter Name="SHI_AI_Province" Type="String" />
                <asp:Parameter Name="SHI_AI_Country" Type="String" />
                <asp:Parameter Name="SHI_IdShippingMethod" Type="String" />
                <asp:Parameter Name="SHI_IdFreightTerms" Type="String" />
            </InsertParameters>
        </asp:SqlDataSource>
    
    
    
    <asp:ImageButton ID="btnNewAddres" runat="server"  ImageUrl="~/images/btnNuevo.png"  CssClass="botones"  OnClick="nuevaDireccion" 
                    Text="Nuevo" Visible="false" />
                          
    </ContentTemplate>
    
</ajaxcontroltoolkit:TabPanel>        
</ajaxcontroltoolkit:TabContainer>
</asp:content>

